Before we can run Unity project in HTC Vive, we need to first setup the HTC Vive and download necessary software from Steam. This can be done by following several steps:
Login to your Steam account, go to ‘Library’ → ‘Tools’. Find SteamVR, right click at the status and ‘Install the Game’. See Figure 1.
Figure 1: Step on how to install SteamVR into your computer
Once installed, play the game and you will see a window pop out, where it detects your head mounting gear, your track pad, and your controller. See Figure 2.
Figure 2: Window that shows your setup. (The status will turn green and show ‘Ready’ when the gears are properly connected.)
In order to make your Unity project VR compatible with HTC Vive, there are two important components that need to be executed.
Importing SteamVR Plugin in Unity
Go to ‘Windows’ → ‘Asset Store’. Search ‘SteamVR Plugin’, download and import the package into your project. See Figure 3.
Figure 3: Importing SteamVR Plugin into Unity
New Window will pop out after importing. It will show the recommended setting for the SteamVR Plugin. Accept the recommended setting unless you have specific requirements for your project. See Figure 4.
Figure 4: Recommended Settings for SteamVR Plugin
Configuring Unity to HTC Vive
Find your character and add ‘SteamVR_Camera’ script by ‘AddComponent’--> ‘SteamVR_Camera’. See Figure 5. Note we use Unity’s default avatar from its standard asset.After adding the SteamVR_Camera script, on the inspector, click ‘Expand’ to bring up the component of the camera.
Figure 5: Adding SteamVR_Camera to the character
To add HTC VIVE’s hand controller model, create an empty game object inside the FPSController(origin) and add another script by executing ‘Add Component’ → “SteamVR_Tracked Object”. Change the ‘Index’ in the script from ‘HMD’ to ‘None’. See Figure 6. Rename the game object to ‘Left Controller’. (Same for the right hand controller)
Figure 6: Adding SteamVR_Tracked Object to the character and changing the name from empty Game Object to Left Controller.
Add another ‘Game Object’ within your ‘Left Controller’ and add script that controls the controller by ‘Add Component’→ ‘SteamVR_Render Model’. Change the ‘Shader’ to ‘Standard Shader’.
In order to control the controller, in ‘FPSController (origin)’ add another script by ‘Add Component’ → ‘SteamVR_ Controller Manager’ and drag your controller to ‘Left’ and ‘Right’. See Figure 7.
Figure 7: Adding SteamVR_Controller Manager to the character
To add play area into your scene, add script in the ‘Origin’ by ‘Add Component’ → ‘SteamVR_Play Area’. A border should appear on your scene. This will configure the area that you can play with. See Figure 8.
Figure 8: Adding SteamVR_Play Area into your scene
Building the Game
Build the game through File → Build and Run to enjoy your first VR game.
How to Configure your Unity Project to HTC Vive
Download and Install SteamVR in Steam
Before we can run Unity project in HTC Vive, we need to first setup the HTC Vive and download necessary software from Steam. This can be done by following several steps:
Figure 1: Step on how to install SteamVR into your computer
Figure 2: Window that shows your setup. (The status will turn green and show ‘Ready’ when the gears are properly connected.)
Setup in Unity
In order to make your Unity project VR compatible with HTC Vive, there are two important components that need to be executed.
Go to ‘Windows’ → ‘Asset Store’. Search ‘SteamVR Plugin’, download and import the package into your project. See Figure 3.
Figure 3: Importing SteamVR Plugin into Unity
Figure 4: Recommended Settings for SteamVR Plugin
Figure 5: Adding SteamVR_Camera to the character
Figure 6: Adding SteamVR_Tracked Object to the character and changing the name from empty Game Object to Left Controller.
Figure 7: Adding SteamVR_Controller Manager to the character
Figure 8: Adding SteamVR_Play Area into your scene
Links:
Home
Revit to Unity